#include <iostream>
#include <string>
using namespace std;
int simple (int n){
int d=0;
for (int i=1; i<=n;i++)
    if (n % i == 0) d++;
    if (d == 2) return true;
    return 0;
}

int main(){

    string text;
    getline(cin, text);
//
    int pr=0;
    for (int i=0; i < text.size(); i++)
        if (text[i] == ' ')
            pr++;

    string slova[pr+1];
    string word;

    int k = 0;
    for (int i=0; i < text.size(); i++){
        if (text[i] == ' '){
            slova[k] = word;
            word = "";
            k++;
        }
        else word += text[i];
    }
      slova[k]=word;
int s=0, d=0, e=0,n=0;
if (slova[1]== "one") s=1;
if (slova[1]== "two") s=2;
if (slova[1]== "three") s=3;
if (slova[1]== "four") s=4;
if (slova[1]== "five") s=5;
if (slova[1]== "six") s=6;
if (slova[1]== "seven") s=7;
if (slova[1]== "eight") s=8;
if (slova[1]== "nine") s=9;
if (slova[1]== "zero") s=0;

if (slova[2]== "one") d=1;
if (slova[2]== "two") d=2;
if (slova[2]== "three") d=3;
if (slova[2]== "four") d=4;
if (slova[2]== "five") d=5;
if (slova[2]== "six") d=6;
if (slova[2]== "seven") d=7;
if (slova[2]== "eight") d=8;
if (slova[2]== "nine") d=9;
if (slova[2]== "zero") d=0;

if (slova[3]== "one") e=1;
if (slova[3]== "two") e=2;
if (slova[3]== "three") e=3;
if (slova[3]== "four") e=4;
if (slova[3]== "five") e=5;
if (slova[3]== "six") e=6;
if (slova[3]== "seven") e=7;
if (slova[3]== "eight") e=8;
if (slova[3]== "nine") e=9;
if (slova[3]== "zero") e=0;
n=s*100+d*10+e;
cout<<simple(n);
}














